<?php
require __DIR__ . '/../bootstrap.php';
$em = require __DIR__ . '/../example/em.php';
include "../data/mysql.php";

use Service\UserManager;

$sql = "SELECT `id`, `name` FROM `user` WHERE `group_id` = '2'";
$result = $em->getConnection()->query($sql)->fetchAll();
//echo '<pre>';
//print_r($result);
//echo '</pre>';
$user_list = '';
foreach ($result as $key) {
    $user_list .= '<option value = "' . $key['id'] . '" > ' . $key['name'] . '</option >';
    $result[] = array('value' => $key['id'], 'text' => $key['name']);
}
/*
echo $user_list;
echo '<pre>';
print_r($result);
echo '</pre>';
*/
echo json_encode($result);
?>